import { registerAppMenu } from '@/app'
import { type AuxCircle, toPolygon, toFeature } from './core'
import { setInteraction } from '@/map-interaction'
import { DrawAuxCircle } from './draw-aux-circle'
import { registerAuxGraphicType } from '../core'
import AuxCircleInfoVue from './AuxCircleInfo.vue'

export function setupAuxCircle() {
  registerAuxGraphicType<AuxCircle>({
    type: 'Circle',
    typeName: '辅助圆',
    geometry: (e) => [toPolygon(e)],
    feature: toFeature,
    component: AuxCircleInfoVue
  })
  registerAppMenu({
    path: '工具/地图Aux:绘制辅助圆',
    onClick() {
      setInteraction(new DrawAuxCircle())
    }
  })
}
